<!DOCTYPE html>
<html lang="zh-CN">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>05-fastclick插件使用</title>
  <style>
    div {
      width: 50px;
      height: 50px;
      background-color: pink;
    }
  </style>
  <script src="fastclick.js"></script>
</head>

<body>
  <div></div>
  <script>
    if ('addEventListener' in document) {
      // 所有点击事件的300ms已经去除
      document.addEventListener('DOMContentLoaded', function () {
        FastClick.attach(document.body);
      }, false);
    }
    var div = document.querySelector('div');
    div.addEventListener('click', function () {
      alert(11);
    })
  </script>
</body>

</html>